<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
namespace App\Events;

use App\Models\User;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class Notify
{
    use Dispatchable;
    use InteractsWithSockets;
    use SerializesModels;

    public const SYSTEM = 1;

    // 待收货
    public const ORDER = 2;

    // 待评价
    public const ACTIVE = 3;

    public $user;

    public $msg;

    /**
     * Create a new event instance.
     *
     * @param mixed $type
     * @param mixed $msg
     */
    public function __construct(User $user, $type, $msg)
    {
        $this->user = $user;
        $this->type = $type;
        $this->msg = $msg;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return array|\Illuminate\Broadcasting\Channel
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
